package controller;

import model.Employee;
import model.EmployeeDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-12-19
 * Time：23:15
 */
@WebServlet("/shows")
public class ShowServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        EmployeeDao employeeDao = new EmployeeDao();
        List<Employee> employees = employeeDao.selectAll();
        System.out.println(employees);
        req.setAttribute("employees", employees);
        req.getRequestDispatcher("/shows.jsp").forward (req, resp);
    }
}
